package com.ljx.thread.thread06;


import lombok.Data;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * @author LJX
 * @Description: TODO
 * @Date: 2022/11/2 10:32
 * @Version 1.0
 */
public class CallAbleThread {
	public static void main(String[] args) {
		ExecutorService executorService = Executors.newFixedThreadPool(1);
		Future<Integer> submit = executorService.submit(new MyCallAble());
		System.out.println(submit);
		executorService.shutdown();

	}
}

@Data
class MyCallAble implements Callable<Integer>{
	@Override
	public Integer call() throws Exception {
		int sum=0;
		for (int i = 0; i < 100; i++) {
			sum+=i;
		}
		return sum;
	}
}